package com.chenzhengrong.demospringboot.controlloer;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.api.R;
import com.chenzhengrong.demospringboot.domain.pojo.PartyOrganization;
import com.chenzhengrong.demospringboot.service.PartyOrganizationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenzhengrong
 * @title: PartyOrganizationController
 * @description: 树结构 前端控制器
 * @date 2022/11/17 16:33
 */
@Api(tags = "树结构表")
@RestController
@RequestMapping("/api/PartyOrganization")
public class PartyOrganizationController {

    @Autowired
    private PartyOrganizationService partyOrganizationService;

    @ApiOperation("树结构列表")
    @GetMapping("/list")
    public R getPartyOrganizationList() {
        return R.ok(partyOrganizationService.listTree());
    }

    @ApiOperation("查询树结构列表")
    @GetMapping("/list/{name}")
    public R getPartyOrganizationListByName(@PathVariable("name") String name) {
        return R.ok(partyOrganizationService.listTree(name));
    }

}
